﻿using System;
using System.ComponentModel;

namespace HalconDotNet
{
	/// <summary>Represents an instance of a classification lookup table</summary>
	// Token: 0x02000023 RID: 35
	public class HClassLUT : HHandle
	{
		// Token: 0x060002CA RID: 714 RVA: 0x0000883B File Offset: 0x00006A3B
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassLUT() : base(HHandleBase.UNDEF)
		{
		}

		// Token: 0x060002CB RID: 715 RVA: 0x0001129C File Offset: 0x0000F49C
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassLUT(IntPtr handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x060002CC RID: 716 RVA: 0x000112AB File Offset: 0x0000F4AB
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassLUT(HHandle handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x060002CD RID: 717 RVA: 0x000112BA File Offset: 0x0000F4BA
		private void AssertSemType()
		{
			base.AssertSemType("class_lut");
		}

		// Token: 0x060002CE RID: 718 RVA: 0x000112C7 File Offset: 0x0000F4C7
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HClassLUT obj)
		{
			obj = new HClassLUT(HHandleBase.UNDEF);
			return obj.Load(proc, parIndex, err);
		}

		// Token: 0x060002CF RID: 719 RVA: 0x000112E0 File Offset: 0x0000F4E0
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HClassLUT[] obj)
		{
			HTuple htuple;
			err = HTuple.LoadNew(proc, parIndex, err, out htuple);
			obj = new HClassLUT[htuple.Length];
			for (int i = 0; i < htuple.Length; i++)
			{
				obj[i] = new HClassLUT(HalconAPI.IsLegacyHandleMode() ? htuple[i].IP : htuple[i].H);
			}
			htuple.Dispose();
			return err;
		}

		/// <summary>
		///   Create a look-up table using a k-nearest neighbors classifier (k-NN) to classify byte images.
		///   Modified instance represents: Handle of the LUT classifier.
		/// </summary>
		/// <param name="KNNHandle">Handle of the k-NN classifier.</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		// Token: 0x060002D0 RID: 720 RVA: 0x00011350 File Offset: 0x0000F550
		public HClassLUT(HClassKnn KNNHandle, HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(1819);
			HalconAPI.Store(proc, 0, KNNHandle);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(KNNHandle);
		}

		/// <summary>
		///   Create a look-up table using a gaussian mixture model to classify byte images.
		///   Modified instance represents: Handle of the LUT classifier.
		/// </summary>
		/// <param name="GMMHandle">GMM handle.</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		// Token: 0x060002D1 RID: 721 RVA: 0x000113C0 File Offset: 0x0000F5C0
		public HClassLUT(HClassGmm GMMHandle, HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(1820);
			HalconAPI.Store(proc, 0, GMMHandle);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(GMMHandle);
		}

		/// <summary>
		///   Create a look-up table using a Support-Vector-Machine to classify byte images.
		///   Modified instance represents: Handle of the LUT classifier.
		/// </summary>
		/// <param name="SVMHandle">SVM handle.</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		// Token: 0x060002D2 RID: 722 RVA: 0x00011430 File Offset: 0x0000F630
		public HClassLUT(HClassSvm SVMHandle, HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(1821);
			HalconAPI.Store(proc, 0, SVMHandle);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(SVMHandle);
		}

		/// <summary>
		///   Create a look-up table using a multi-layer perceptron to classify byte images.
		///   Modified instance represents: Handle of the LUT classifier.
		/// </summary>
		/// <param name="MLPHandle">MLP handle.</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		// Token: 0x060002D3 RID: 723 RVA: 0x000114A0 File Offset: 0x0000F6A0
		public HClassLUT(HClassMlp MLPHandle, HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(1822);
			HalconAPI.Store(proc, 0, MLPHandle);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(MLPHandle);
		}

		/// <summary>
		///   Classify a byte image using a look-up table.
		///   Instance represents: Handle of the LUT classifier.
		/// </summary>
		/// <param name="image">Input image.</param>
		/// <returns>Segmented classes.</returns>
		// Token: 0x060002D4 RID: 724 RVA: 0x00011510 File Offset: 0x0000F710
		public HRegion ClassifyImageClassLut(HImage image)
		{
			IntPtr proc = HalconAPI.PreCall(428);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HRegion result;
			num = HRegion.LoadNew(proc, 1, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			return result;
		}

		/// <summary>Clear a look-up table classifier.</summary>
		/// <param name="classLUTHandle">Handle of the LUT classifier.</param>
		// Token: 0x060002D5 RID: 725 RVA: 0x00011568 File Offset: 0x0000F768
		public static void ClearClassLut(HClassLUT[] classLUTHandle)
		{
			HTuple htuple = HHandleBase.ConcatArray(classLUTHandle);
			IntPtr proc = HalconAPI.PreCall(1818);
			HalconAPI.Store(proc, 0, htuple);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(htuple);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(classLUTHandle);
		}

		/// <summary>
		///   Clear a look-up table classifier.
		///   Instance represents: Handle of the LUT classifier.
		/// </summary>
		// Token: 0x060002D6 RID: 726 RVA: 0x000115AC File Offset: 0x0000F7AC
		public void ClearClassLut()
		{
			IntPtr proc = HalconAPI.PreCall(1818);
			base.Store(proc, 0);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create a look-up table using a k-nearest neighbors classifier (k-NN) to classify byte images.
		///   Modified instance represents: Handle of the LUT classifier.
		/// </summary>
		/// <param name="KNNHandle">Handle of the k-NN classifier.</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		// Token: 0x060002D7 RID: 727 RVA: 0x000115E0 File Offset: 0x0000F7E0
		public void CreateClassLutKnn(HClassKnn KNNHandle, HTuple genParamName, HTuple genParamValue)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1819);
			HalconAPI.Store(proc, 0, KNNHandle);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(KNNHandle);
		}

		/// <summary>
		///   Create a look-up table using a gaussian mixture model to classify byte images.
		///   Modified instance represents: Handle of the LUT classifier.
		/// </summary>
		/// <param name="GMMHandle">GMM handle.</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		// Token: 0x060002D8 RID: 728 RVA: 0x00011650 File Offset: 0x0000F850
		public void CreateClassLutGmm(HClassGmm GMMHandle, HTuple genParamName, HTuple genParamValue)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1820);
			HalconAPI.Store(proc, 0, GMMHandle);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(GMMHandle);
		}

		/// <summary>
		///   Create a look-up table using a Support-Vector-Machine to classify byte images.
		///   Modified instance represents: Handle of the LUT classifier.
		/// </summary>
		/// <param name="SVMHandle">SVM handle.</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		// Token: 0x060002D9 RID: 729 RVA: 0x000116C0 File Offset: 0x0000F8C0
		public void CreateClassLutSvm(HClassSvm SVMHandle, HTuple genParamName, HTuple genParamValue)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1821);
			HalconAPI.Store(proc, 0, SVMHandle);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(SVMHandle);
		}

		/// <summary>
		///   Create a look-up table using a multi-layer perceptron to classify byte images.
		///   Modified instance represents: Handle of the LUT classifier.
		/// </summary>
		/// <param name="MLPHandle">MLP handle.</param>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		// Token: 0x060002DA RID: 730 RVA: 0x00011730 File Offset: 0x0000F930
		public void CreateClassLutMlp(HClassMlp MLPHandle, HTuple genParamName, HTuple genParamValue)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1822);
			HalconAPI.Store(proc, 0, MLPHandle);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(MLPHandle);
		}
	}
}
